# _*_ coding:utf-8 _*_
# @author : Joyamon
# @time : 2022-12-23 17:38
# @file : calc.py


class BillingScheme:
    """
    计费方案(按点缴纳)
    """

    def __init__(self, total_contract_price):
        # 项目合同总价
        self.total_contract_price = total_contract_price

    def account(self):
        """
        金额
        """
        self.a = float(input('请输入金额：'))
        self.b = float(input('请输入金额：'))
        self.c = float(input('请输入金额：'))
        self.d = float(input('请输入金额：'))
        self.e = float(input('请输入金额：'))

    def rate(self):
        self.rate_a = float(input('请输入平台费率：'))
        self.rate_a_b = float(input('请输入平台费率：'))
        self.rate_b_c = float(input('请输入平台费率：'))
        self.rate_c_d = float(input('请输入平台费率：'))
        self.rate_d = float(input('请输入平台费率：'))

    def point(self):
        """
        工程类  按点缴纳
        项目合同总价（万）<50 ，平台服务费=3%；
        50=<项目合同总价（万）<500 ，平台服务费=2.5%；
        500=<项目合同总价（万）<1500 ，平台服务费=2.0%；
        1500=<项目合同总价（万）<3000 ，平台服务费=1.5%；
        3000=<项目合同总价（万）,平台服务费=1.0%；
        """
        if self.total_contract_price < self.a:
            self.platform_service_fee = self.total_contract_price * self.rate_a
        elif self.a <= self.total_contract_price < self.b:
            self.platform_service_fee = self.total_contract_price * self.rate_a_b
        elif self.b <= self.total_contract_price < self.c:
            self.platform_service_fee = self.total_contract_price * self.rate_b_c
        elif self.c <= self.total_contract_price < self.d:
            self.platform_service_fee = self.total_contract_price * self.rate_c_d
        elif self.total_contract_price >= self.d:
            self.platform_service_fee = self.total_contract_price * self.rate_d
        return self.platform_service_fee

    def area(self):
        """
        按照面积
        """
        pass


class year:
    """
    按年缴纳
    """
    # 大客户商务经理（含深圳）全国（含深圳）
    year_1 = 200000
    # 大客户商务经理（不含深圳）全国（不含深圳）
    year_2 = 180000
    # 广东省的省级商务经理（含深圳）
    year_3 = 150000
    # 广东省的省级商务经理（不含深圳）/其他省的省级商务经理
    year_4 = 120000
    # 地市级商务经理/一线城市（指：北上广津渝）
    year_5 = 100000
    # 地市级商务经理：二级城市（省会城市及副省级城市）
    year_6 = 80000
    # 地市级商务/三线及以下城市
    year_7 = 60000


class FeeDeductionScheme:
    """
    扣费方案(周期）
    """

    def __init__(self):
        # 扣费金额
        print("按年扣费请输入 ：Y")
        print("按半年扣费请输入：HY")
        print("按季度扣费请输入：Q")
        print("按月度计费请输入：M ")
        self.amount = float(input('请输入扣费金额：'))
        self.YEAR = 'Y'  # 年度
        self.HALF_YEAR = 'HY'  # 半年
        self.QUARTER = 'Q'  # 季度
        self.MONTHLY = 'M'  # 月度

    def periodicDeduction(self):
        """
        周期扣费
        """
        mode = input('请输入周期扣费方式：')
        if mode == self.YEAR:
            year_rate = float(input('请输入年度扣费比例：'))
            if year_rate != float(100):
                return '输入比例之要等于100%'
            amount_deducted = year_rate / 100 * self.amount
            if amount_deducted > self.amount:
                return ' 扣费金额大于计费金额'
            return f'年度扣费金额:{amount_deducted}'
        if mode == self.HALF_YEAR:
            first_half_rate = float(input('请输入上半年扣费比例：'))
            second_half_rate = float(input('请输入下半年扣费比例：'))
            if (first_half_rate + second_half_rate) != float(100):
                return '输入比例之要等于100%'
            first_half_amount = first_half_rate / 100 * self.amount
            second_half_amount = second_half_rate / 100 * self.amount
            all_year_amount = first_half_amount + second_half_amount
            if all_year_amount > self.amount:
                return '扣费金额大于计费金额'
            return f'上半年扣费金额{first_half_amount},下半年扣费金额{second_half_amount},全年扣费金额{all_year_amount}'
        if mode == self.QUARTER:
            first_quarter = float(input('请输入第一季度扣费比例：'))
            second_quarter = float(input('请输入第二季度扣费比例：'))
            third_quarter = float(input('请输入第三季度扣费比例：'))
            forth_quarter = float(input('请输入第四季度扣费比例：'))
            if (first_quarter + second_quarter + third_quarter + forth_quarter) != float(100):
                return '输入比例之要等于100%'
            first_quarter_amount = first_quarter / 100 * self.amount
            second_quarter_amount = second_quarter / 100 * self.amount
            third_quarter_amount = third_quarter / 100 * self.amount
            forth_quarter_amount = forth_quarter / 100 * self.amount
            all_year_amount = first_quarter_amount + second_quarter_amount + third_quarter_amount + \
                              forth_quarter_amount
            if all_year_amount > self.amount:
                return '扣费金额大于计费金额'
            return f'一季度扣费金额:{first_quarter_amount},二季度扣费金额:{second_quarter_amount},' \
                   f'三季度扣费金额:{third_quarter_amount},四季度扣费金额:{forth_quarter_amount},' \
                   f'全年扣费金额:{all_year_amount}'
        if mode == self.MONTHLY:
            Jan = float(input('请输入一月扣费比例：'))
            Feb = float(input('请输入二月扣费比例：'))
            Mar = float(input('请输入三月扣费比例：'))
            Apr = float(input('请输入四月扣费比例：'))
            May = float(input('请输入五月扣费比例：'))
            Jun = float(input('请输入六月扣费比例：'))
            Jul = float(input('请输入七月扣费比例：'))
            Aug = float(input('请输入八月扣费比例：'))
            Sep = float(input('请输入九月扣费比例：'))
            Oct = float(input('请输入十月扣费比例：'))
            Nov = float(input('请输入十一月扣费比例：'))
            Dec = float(input('请输入十二月扣费比例：'))
            if (Jan + Feb + Mar + Apr + May + Jun + Jul + Aug + Sep + Oct + Nov + Dec) != float(100):
                return '输入比例之要等于100%'
            Jan_amount = Jan / 100 * self.amount
            Feb_amount = Feb / 100 * self.amount
            Mar_amount = Mar / 100 * self.amount
            Apr_amount = Apr / 100 * self.amount
            May_amount = May / 100 * self.amount
            Jun_amount = Jun / 100 * self.amount
            Jul_amount = Jul / 100 * self.amount
            Aug_amount = Aug / 100 * self.amount
            Sep_amount = Sep / 100 * self.amount
            Oct_amount = Oct / 100 * self.amount
            Nov_amount = Nov / 100 * self.amount
            Dec_amount = Dec / 100 * self.amount
            all_year_amount = Jan_amount + Feb_amount + Mar_amount + Apr_amount + May_amount + \
                              Jun_amount + Jul_amount + Aug_amount + Sep_amount + Oct_amount + Nov_amount + Dec_amount
            if all_year_amount > self.amount:
                return '扣费金额大于计费金额'
            return f'一月扣费金额:{Jan_amount}，二月扣费金额:{Feb_amount}，三月扣费金额:{Mar_amount}，' \
                   f'四月扣费金额:{Apr_amount}，' \
                   f'五月扣费金额:{May_amount}，六月扣费金额:{Jun_amount}，七月扣费金额:{Jul_amount}，' \
                   f'八月扣费金额:{Aug_amount}，九月扣费金额:{Sep_amount}，' \
                   f'十月扣费金额:{Oct_amount}，十一月扣费金额:{Nov_amount}，' \
                   f'十二月扣费金额:{Dec_amount}，全年扣费金额:{all_year_amount}'


class SettlementScheme:
    """
    结算方案
    """

    def __init__(self):
        pass


if __name__ == '__main__':
    # b = BillingScheme(600000)
    # b.account()
    # b.rate()
    # print(b.point())
    while 1:
        f = FeeDeductionScheme()
        print(f.periodicDeduction())
